﻿import QtQuick 2.0
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Styles 1.4
import "../components"

Item {
    visible: true
    width: 800
    height: 400

    property int isd : 0

    anchors.horizontalCenter: parent.horizontalCenter //水平居中
    Column {
        spacing: 20*dp
        anchors.centerIn: parent
        Row {
            spacing: 10*dp
            Text {
                text: qsTr("默认文件导出路径")
                font.pixelSize: config.fontsize
                verticalAlignment: Text.AlignVCenter
                anchors.verticalCenter: parent.verticalCenter // 垂直居中
            }
            Rectangle{

                width: 250*dp
                height: 40*dp
                color: "white"
                border.color: "#CCCCCC"
                radius: 3

                Text {
                    id: pathtext
                    text: CSetUp.readDefPath()
                    anchors.fill: parent
                    anchors.margins: 5
                    font.pixelSize: config.fontsize
                    color: "grey"
                    verticalAlignment: Text.AlignVCenter
                    anchors.verticalCenter: parent.verticalCenter // 垂直居中
                    elide: Text.ElideRight // 文本超出时，在右侧截断并显示省略号
                }
            }
            PushButton{
                defaultMode2: true
                button_icon: "qrc:/picture/iconXZ.png"
                title: "选择路径"
                onReleased: {
                    CSetUp.choosePath()
                    pathtext.text=CSetUp.readPath()
                }
            }
        }

        Row{
            spacing: 10*dp
            Text {
                text: qsTr("默认文件导出方式")
                font.pixelSize: config.fontsize
                verticalAlignment: Text.AlignVCenter
                anchors.verticalCenter: parent.verticalCenter // 垂直居中
            }CheckBox{
                id: myCheckBox
                text: qsTr("自动导出")
                font.pixelSize: config.fontsize
                checked: true
                onCheckedChanged: {
                    if (myCheckBox.checked) {
                        isd = 0
                    } else {
                        isd = 1
                    }
                }
            }
        }

        Row{
            spacing: 5*dp
            Text {
                text: qsTr("*")
                color: "red"
                font.pixelSize: config.fontsize
                verticalAlignment: Text.AlignVCenter
            }Text {
                color: "#777777"
                text: qsTr("注：导出报告可选择本地和网络路径，自动导出即实验完成后自动导出报告到上面路径下")
                font.pixelSize: config.fontsize
                verticalAlignment: Text.AlignVCenter
            }
        }

        PushButton{
            defaultMode1: true
            title: "保存"
            onReleased: {
                CSetUp.writeDefPath()
                CSetUp.autoDout(isd)
            }
        }
    }
}
